package com.youdoneed.friends.vo;

import java.util.List;

public class DataCounts {

    private List<Count> counts;

    public DataCounts() {
    }

    public DataCounts(List<Count> counts) {
        this.counts = counts;
    }

    public Long getCount(String id) {
        if (counts == null) {
            return null;
        }
        for (Count count : counts) {
            if (count != null && ((count.getId() == null && id == null)
                    || (count.getId() != null && count.getId().equals(id)))) {
                return count.getCount();
            }
        }
        return null;
    }

    public List<Count> getCounts() {
        return counts;
    }

    public void setCounts(List<Count> counts) {
        this.counts = counts;
    }

    public static class Count {
        private String id;
        private Long count;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public Long getCount() {
            return count;
        }

        public void setCount(Long count) {
            this.count = count;
        }
    }

}